package com.zablert.mainactivity.teaching;

import android.view.View;
import android.widget.TextView;

import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class BaseViewHolder extends RecyclerView.ViewHolder {
    public BaseViewHolder(@NonNull View itemView) {
        super(itemView);
    }

    public BaseViewHolder setText(@IdRes int id, CharSequence text) {
        View view = itemView.findViewById(id);
        if (view instanceof TextView) {
            ((TextView) view).setText(text);
        }
        return this;
    }

    public BaseViewHolder setTextColor(@IdRes int id, @ColorInt int color) {
        View view = itemView.findViewById(id);
        if (view instanceof TextView) {
            ((TextView) view).setTextColor(color);
        }
        return this;
    }

    public BaseViewHolder setTextSize(@IdRes int id, float size) {
        View view = itemView.findViewById(id);
        if (view instanceof TextView) {
            ((TextView) view).setTextSize(size);
        }
        return this;
    }

}
